package luj.tool.jnproxyan.proxy.network.logger;

import org.slf4j.Logger;

public class Client2pLogger {

  public Client2pLogger(Logger log, Long socksId) {
    _log = log;
    _socksId = socksId;
  }

  public void log(String format, Object... arg) {
    if (!_log.isDebugEnabled()) {
      return;
    }

    _log.debug(makeFormat("→", format), arg);
  }

  public void log2c(String format, Object... arg) {
    if (!_log.isDebugEnabled()) {
      return;
    }

    _log.debug(makeFormat("←", format), arg);
  }

  private String makeFormat(String dir, String formatPart) {
    return "浏览器" + dir + "代理：" +
        "#" + _socksId + "，"
        + formatPart;
  }

  @SuppressWarnings("NonConstantLogger")
  private final Logger _log;

  private final Long _socksId;
}
